package com.example.mybatis_generation.controller;


import com.example.mybatis_generation.dao.ParentListMapper;
import com.example.mybatis_generation.domain.vo.ParentListVo;
import com.example.mybatis_generation.service.impl.ParentListServiceImpl;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author qiDing
 * @since 2021-12-14
 */
@RestController
@AllArgsConstructor
public class ParentListController {

    private final ParentListMapper parentListMapper;
    private final ParentListServiceImpl parentListService;

    /**
     * 无限嵌套查询示例
     */
    @GetMapping("/get")
    public Object getTree(Integer parentId) {
        return parentListMapper.listParentTree(parentId);
    }

    /**
     * 嵌套查询分页示例
     */
    @GetMapping("/getPage")
    public Object getTreePage(Integer parentId, Integer pageNum, Integer pageSize) {
        return parentListService.pageListTree(parentId,pageNum,pageSize);
    }
}

